#include <Editor/StdAfx.h>
#include <Editor/MainFrame.h>
#include <Editor/MessageWindow.h>

enum
{
	ID_QUIT = 1,
	ID_ABOUT,
};

BEGIN_EVENT_TABLE(MainFrame, wxFrame)
	EVT_MENU(ID_QUIT, MainFrame::OnQuit)
	EVT_MENU(ID_ABOUT, MainFrame::OnAbout)
END_EVENT_TABLE()

//----------------------------------------------------------------------------
MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
	: wxFrame(0, -1, title, pos, size)
{
	mAuiMgr.SetManagedWindow(this);
	wxMenu *menuFile = new wxMenu;
	menuFile->Append( ID_ABOUT, _("&About..."));
	menuFile->AppendSeparator();
	menuFile->Append( ID_QUIT, _("E&xit"));

	wxMenuBar* menuBar = new wxMenuBar;
	menuBar->Append(menuFile, _("&File"));

	SetMenuBar(menuBar);

	CreateStatusBar();
	SetStatusText( _("Ready..."));

	wxSize clientSize = GetClientSize();

	mMessageWindow = new MessageWindow(this);
	mAuiMgr.AddPane
		(
			mMessageWindow, 
			wxAuiPaneInfo().CloseButton(false).Caption(_("Message Window")).BestSize(clientSize.x*0.5, 100)
			.Bottom().Position(0).Row(0).Layer(0),
			wxPoint(clientSize.x*0.5, clientSize.y*0.9)
		);

	mAuiMgr.Update();
}

//----------------------------------------------------------------------------
MainFrame::~MainFrame()
{
	mAuiMgr.UnInit();
}

//----------------------------------------------------------------------------
void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
	Close(true);
}

//----------------------------------------------------------------------------
void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
	wxMessageBox(_("fastbird Editor"), _("About"), wxOK|wxICON_INFORMATION);
}
